var t = getApp();

Page({
    data: {
        active: 0,
        info: {
            plugin_name: "分销收入奖励记录"
        },
        isLoadMore: !1,
        list: [],
        loading: !1,
        page: 1,
        noMore: !1
    },
    onLoad: function(t) {},
    onReady: function() {},
    onShow: function() {
        this.getdata();
    },
    initdata: function() {
        this.setData({
            isLoadMore: !1,
            page: 1,
            info: {},
            list: [],
            loading: !0
        });
    },
    $toast: function(t) {
        wx.showToast({
            title: t,
            duration: 1e3,
            icon: "none"
        });
    },
    getdata: function() {
        var a = this;
        this.initdata();
        var o = t.getNetAddresss("plugin.distribution-income.frontend.controllers.center.index");
        t._postNetWork({
            url: o,
            success: function(t) {
                var o = t.data, n = o.result, e = o.data, i = o.msg;
                a.setData({
                    loading: !1
                }), 1 == n ? (wx.setNavigationBarTitle({
                    title: e.info.plugin_name || "分销收入奖励记录"
                }), a.setData({
                    info: e.info,
                    list: e.list.data
                }), a.setMore(a.data.page == e.list.last_page)) : a.$toast(i);
            }
        });
    },
    setMore: function() {
        var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
        this.setData({
            noMore: t,
            isLoadMore: !t
        });
    },
    getMoreData: function() {
        var a = this;
        this.setData({
            loading: !0,
            isLoadMore: !1
        });
        var o = this.data.page + 1, n = t.getNetAddresss("plugin.distribution-income.frontend.controllers.center.index");
        t._postNetWork({
            url: n,
            data: {
                page: o
            },
            success: function(t) {
                var n = t.data, e = n.result, i = n.data, s = n.msg;
                a.setData({
                    loading: !1
                }), 1 == e ? (a.setData({
                    list: a.data.list.concat(i.list.data),
                    page: o
                }), a.setMore(a.data.page == i.list.last_page)) : a.$toast(s);
            }
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : this.$toast("没有更多了~~~");
    },
    onShareAppMessage: function() {}
});